<?php get_instance()->view('common/header');?>
<style>
    .content-btn-box,.content-box{margin-top:10px;}
    .container {
        width: 100%;
    }
    .add-tag-btn{line-height: 40px;}
    .option-item {
        margin-bottom: 5px;
        position: relative;
    }
    .del-tag-btn{font-size: 14px;line-height: 36px;display: block;margin-bottom: 4px;}
    .del-tag-btn a{color: red;}
</style>
<div class="page-container home">
    <?php get_instance()->view('common/sidebar');?>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                    <h3 class="page-title"> <?php echo $title;?></h3>
                    <ul class="page-breadcrumb breadcrumb">
                        <li class="btn-group"> <a class="btn default ml_5 return" href="<?php echo getUrl('mall/home');?>"><i class="fa fa-chevron-left"></i> 返回</a> </li>
                        <li><i class="fa fa-home"></i><a href="<?php echo getUrl('mall/home');?>">礼品管理 </a><i class="fa fa-angle-right"></i></li>
                        <li><a href="javascript:void(0);"><?php echo $add ? '添加' : '编辑';?>礼品</a></li>
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN VALIDATION STATES-->
                    <div class="portlet box">
                        <div class="portlet-body form">
                            <!-- BEGIN FORM-->
                            <form action="<?php echo getUrl('mall/home/save')?>" class="form-horizontal" method="post" id="main-form" novalidate="novalidate">
                                <div class="form-body">

                                    <div class="form-group">
                                        <label class="control-label col-md-2">封面图<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <div class="cropitMaster-box" style="width:124px;height:124px;&quot;">
                                                <img style="width:100%;height:100%;" id="icn-img" alt="" src="<?php echo ! $add ? $info['imgurl'] : getDefaultImg();?>">
                                            </div>
                                            <a class="upload-btn" href="javascript:void(0);">选择上传图片（320*320）</a>
                                            <input type="hidden" name="imgurl" id="pic" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">轮播图<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <div id="uploader-demo">
                                                <!--用来存放item-->
                                                <div class="uploader-list">
                                                    <?php if (! $add && $info['showurl']):?>
                                                        <?php  foreach ($info['showurl'] as $v):?>
                                                            <div id="" class="file-item thumbnail pic-list">
                                                                <img src="<?php echo $v; ?>">
                                                                <a title="删除" class="delete-btn hide" href="javascript:void(0);" style="color:#b94a48;position:absolute;top:-10px;right:-5px;background-color:#ffff;height:17px;width:15px;font-size:12px;padding:2px;">
                                                                    <i class="fa fa-times"></i>
                                                                </a>
                                                                <input name="showurl[]" type="hidden" class="file-name" value="<?php echo $v; ?>">
                                                            </div>
                                                        <?php endforeach; endif;?>
                                                    <div id="filePicker" class="file-item thumbnail webuploader-container">
                                                        <div class="webuploader-pick">
                                                            <div style="position:absolute;top:0;left:0;width:100%;height:100%;padding-top:80px;color:grey;">选择图片</div>
                                                            <img title="选择上传图片" src="<?php echo getDefaultImg(); ?>">
                                                        </div>
                                                        <div id="rt_rt_1c2t7atu83351ra0bvm7gcgnu1" style="position: absolute; top: 4px; left: 4px; width: 100px; height: 100px; overflow: hidden; bottom: auto; right: auto;">
                                                            <input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*">
                                                            <label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);">
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <script type="text/javascript">
                                                    $(function(){
                                                        uploadImg({
                                                            box:'#uploader-demo',
                                                            uploadBtn:"#filePicker",
                                                            fileName:'showurl[]',
                                                            width:110,  //显示缩略图宽带
                                                            uploadUrl:'<?php echo getUrl('product/home/uploadImgs');?>',
                                                            height:100,	//显示缩略图高度
                                                            number:3
                                                        });

                                                    });

                                                </script>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label col-md-2">标题<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <input class="form-control required" name="title" type="text" value="<?php echo ! $add ? $info['title'] : '';?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">积分<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <input class="form-control required" name="integral" type="text" value="<?php echo ! $add ? $info['integral'] : '';?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">产品须知<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <textarea  class="form-control required" name="notice" ><?php echo ! $add ? $info['notice'] : ''?></textarea>
                                        </div>
                                    </div>
                                    <!-- 商品描述 -->
                         			<div class="form-group">
                                        <label class="control-label col-md-2">产品介绍<span class="required">*</span></label>
                                        <div class="col-md-6">
                                         	<script  id="introduce" name="introduce" type="text/plain"><?php echo ! $add ? $info['introduce'] : ''?></script>  
                                        </div>
                                    </div>

                                    <div class="form-actionsc fluid">
                                        <div class="col-md-offset-2 col-md-9" style="padding-left: 0;">
                                            <input name="id" value="<?php echo ! $add ? $info['id'] : '';?>" type="hidden">
                                            <button class="btn green"><i class="fa fa-save"></i> 保存</button>
                                            <a class="btn default seach-btn" href="<?php echo getUrl('mall/home');?>"><i class="fa fa-chevron-left"></i> 返回</a>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- END VALIDATION STATES-->
                </div>
                <!-- END PAGE CONTENT-->
            </div>
        </div>
    </div>
</div>
<div class="content-box" type="0" index="0">
    <script index="0" id="" name="free_content[]" type="text/plain"></script>
</div>

<script type="text/javascript">
    $(function(){
        cropitMaster({
            uploadBtn:$('.upload-btn'),
            height:'322px',
            width:'322px',
            complete:function(btn,data){
                $('#icn-img').attr('src', data);
                $('#pic').val(data).change();
            }
        });
        $.e_validate.init('#main-form', {});

        UE.getEditor('introduce',{
        	serverUrl:"<?php echo getUrl('mall/home/editor')?>",
            toolbars: [[
            'fullscreen', 'source', '|', 'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
            'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
            'directionalityltr', 'directionalityrtl', 'indent', '|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
            'link', 'unlink', 'anchor', '|','emotion', 'scrawl','attachment', 'insertcode','pagebreak', 'template', 'background', '|',
            'horizontal', 'date', 'time','simpleupload', 'spechars','|',
            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols'
        ]],autoHeightEnabled:false,initialFrameWidth:'100%',initialFrameHeight:'300'});
    });
</script>
</body>
</html>